﻿<!--#include file="../inc/easp/easp.asp"-->
<!--#include file="../inc/conn1.asp"-->
<!--#include file="../inc/checklogin.asp"-->
<!--#include file="../inc/easyide.asp"-->
<% CheckLogin("../index.asp") %>
<%
    '权限不够直接跳到首页
	If Session("Authority")<>"0" Then
		Response.Write "<script type=""text/javascript"">top.location.href='../main.asp';</script>"
	end if				
%>
<%
  dim y_id,operate
  y_id = Easp.Get("yid")'鑾峰彇瑕佹搷浣滅殑鍥藉ID
    operate = Easp.Get("op")'鑾峰彇鎿嶄綔绫诲瀷銆傚嵆鏄坊鍔犺繕鏄慨鏀?
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<%
    If request.QueryString("action") <> "custom" then
      Select Case request.QueryString("page")
	    Case "country"
		  Easp.w "Edit Country"
		Case "province"
		  Easp.w "Edit Province"
		Case "city"
		  Easp.w "Edit City"
	  End Select
	End if
  %>
  </title>
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript">
	var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
	document.writeln('<link rel="stylesheet" type="text/css" href="../css/' + StyleFile + '">');
	
	function chkv(obj)
    { 
        top.location.href="add.asp?selectedIndex="+obj.selectedIndex;
    } 
    
    function Rrederict()
    { 
        top.location.href="Group.asp";
    } 
</script>

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
</head>
<body>

<%
		dim page
		dim pid
		dim yid
		dim uid
		dim cid
		dim relt
	    dim cityname
	    dim countryname
	    dim provincename
	    dim gid
	    dim groupname
	    
	    dim url

		If request.QueryString("action") = "custom" Then

            page=request.QueryString("page")
            
            If request.QueryString("page") = "country" Then
			     page="country"
			     yid=request.form("yid")
			     'response.write("<Script language=JavaScript>alert('"&yid&"');</Script>")
			     countryname=request.form("txtCountryName")		
			     gid=request.form("gid")
			     
		         relt=Easp.db.UpdateRecord ("Country","y_id=" & yid,Array("CountryName:"&countryname))
				 Response.Redirect "index.asp"		         

		    elseif request.QueryString("page") = "province" Then
		        page="province" 
		        
                pid=request.form("pid")
                yid=request.form("yid")
		        'response.write("<Script language=JavaScript>alert('"&pid&"');</Script>")
		        
		         provincename=request.form("txtProvinceName")
		         
		         relt=Easp.db.UpdateRecord("Province","p_id="&pid,Array("ProvinceName:"&provincename))
		         
		        
                Response.Redirect "Province.asp?action=det&yid="&yid
                
		    elseif request.QueryString("page") = "city" Then
			    page="city" 
			    
			    pid=request.form("pid")
		        yid=request.form("yid")
		        cid=request.form("cid")
		        
		        'response.write("<Script language=JavaScript>alert('"&pid&"');</Script>")
                cityname=request.form("txtCityName")

		        relt=Easp.db.UpdateRecord("City","c_id="&cid,Array("CityName:"&cityname))
		        
	
		        
		        Response.Redirect "City.asp?action=det&pid="&pid
		    End if
            
			If relt<>0 Then
				 response.write("<Script language=JavaScript>alert('update  success');</Script>")
			else
				 response.write("<Script language=JavaScript>alert('update  fail');</Script>")
			End If
	
		else
		    If request.QueryString("page") = "country" Then
			     page="country"
			     yid=request.QueryString("yid") 
			     countryname=request.QueryString("countryname") 
			      gid=request.QueryString("gid")
			     countryname=request.QueryString("countryname") 
			     
			     
		    elseif request.QueryString("page") = "province" Then
		        pid=request.QueryString("pid") 
		        yid=request.QueryString("yid") 
		        provincename=request.QueryString("provincename") 
		        page="province" 

		    elseif request.QueryString("page") = "city" Then
			    page="city" 
			    cid=request.QueryString("cid") 
		        cityname=request.QueryString("cityname") 
		        pid=request.QueryString("pid") 
		    End if
	    End if
		%>
<div id="container">
	<div id="header">
    <div id="divAccount" style="float:right;">
        <a href="../user/account.asp" style="color:white">Account</a>&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="../inc/logout.asp" style="color:white">Logout</a>
      </div>
      <h2>
		<%
    If request.QueryString("action") <> "custom" then
      Select Case request.QueryString("page")
	    Case "country"
		  Easp.w "<h2>Edit Country</h2>"
		Case "province"
		  Easp.w "<h2>Edit Province</h2>"
		Case "city"
		  Easp.w "<h2>Edit City</h2>"
	  End Select
	End if
  %></h2>
		<div id="topmenu">
			<ul>
				<li><a href="../main.asp">Home</a></li>
				<li class="current"><a href="#">Country</a></li>
				<li><a href="../holiday/index.asp">Holiday</a></li>
				<li><a href="../Times/index.asp">Times</a></li>
				<li><a href="../wallboard/index.asp">WallBoard</a></li>
				<%
				   If Session("Authority")="0" Then 
				       Response.Write("<li><a href='../user/index.asp'>User</a></li>")
				   End if
				%>
				<li><% If Session("Passed")=true Then %><a href="../inc/logout.asp">Logout</a><% End If %></li>
			</ul>
		</div>
	</div>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li><a href="<%=request.serverVariables("Http_REFERER")%>" class="goback">GoBack</a></li>
			</ul>
		</div>
	</div>
	
		
		
		<div id="content" align="center">
		    <div id="loginbox" align="center" style="margin: 10px 45px; width: 500px;">
		            <form name="form1" id="form1" action="edit.asp?action=custom&page=<%=page%>" method="post">
		                 <%
						      Easp.w "<input type='hidden' name='pid' value='"&pid&"'/>"
					          Easp.w "<input type='hidden' name='yid' value='"&yid&"'/>"
						      Easp.w "<input type='hidden' name='cid' value='"&cid&"'/>"
						      Easp.w "<input type='hidden' name='gid' value='"&gid&"'/>"
						      Easp.w "<input type='hidden' name='Country' value='" & Session("Country") & "' />"
						      Easp.w "<input type='hidden' name='txtGroup' value='"&groupname&"'/>"
					      %>
		                    
							<div id="divCountry"  name="divCountry">
							<table>
					        <tr>
		                    <%
        		                 Select Case page
								  Case "country"
								    Easp.w "<td>Country Name:</td>"
									Easp.w "<td><input name='txtCountryName' type='text' id='txtCountryName' value='"&countryname&"'/></td>"
								  Case "province"
								    Easp.w "<td>Province Name:</td>"
									Easp.w "<td><input id='txtProvinceName' name='txtProvinceName' type='text' value='"&provincename&"'/></td>"
								  Case "city"
								    Easp.w "<td>City Name:</td>"
									Easp.w "<td><input id='txtCityName' name='txtCityName' type='text' value='"&cityname&"'/></td>"
								End select	
        					     
		                    %>
		                    </tr>
		                   
		                    <tr>
		                    <%       

								    Easp.w "<td><input class='btn' type='submit' value='Alter'/></td>"
									Easp.w "<td><input name='reset' type='reset' class='btn' value='Reset' /></td>"
							 %>

		                    </tr>
					        </table>
					        </div>
					</form>
			 </div>

	        <!--#include file="../inc/footer.asp" -->
        </div>
        </div>
</body>
</html>
